<?php
class Silk_Zgb_Block_Adminhtml_Manufacturer_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
{
		protected function _prepareForm()
		{

				$form = new Varien_Data_Form();
				$this->setForm($form);

				$manufacturer = Mage::registry("manufacturer_data");

				$fieldset = $form->addFieldset("zgb_base_form", array("legend"=>Mage::helper("zgb")->__("厂商基础信息")));

				$fieldset->addField("name", "text", array(
				"label" => Mage::helper("zgb")->__("名称"),					
				"class" => "required-entry",
				"required" => true,
				"name" => "name",
				));
				
			
				$fieldset->addField("contact_name", "text", array(
				"label" => Mage::helper("zgb")->__("联系人"),					
				"class" => "required-entry",
				"required" => true,
				"name" => "contact_name",
				));
			
				$fieldset->addField("contact_phone", "text", array(
				"label" => Mage::helper("zgb")->__("联系电话"),					
				"class" => "required-entry",
				"required" => true,
				"name" => "contact_phone",
				));
			
				$fieldset->addField("contact_address", "text", array(
				"label" => Mage::helper("zgb")->__("联系地址"),					
				"class" => "required-entry",
				"required" => true,
				"name" => "contact_address",
				));

				$fieldset->addField("note", "textarea", array(
				"label" => Mage::helper("zgb")->__("备注"),
				"name" => "note",
				));

				/*$fieldset = $form->addFieldset("zgb_login_form", array("legend"=>Mage::helper("zgb")->__("登录信息")));

				$fieldset->addField("login_name", "text", array(
				"label" => Mage::helper("zgb")->__("登录帐号"),					
				"class" => "required-entry",
				"required" => true,
				"name" => "login_name",
				));

				if(!$manufacturer->getId())
				{
					$fieldset->addField("password", "password", array(
					"label" => Mage::helper("zgb")->__("密码"),					
					"class" => "required-entry validate-admin-password",
					"required" => true,
					"name" => "password",
					));
				}*/

				$fieldset = $form->addFieldset("zgb_form", array("legend"=>Mage::helper("zgb")->__("工商信息")));

				$fieldset->addField("address", "text", array(
				"label" => Mage::helper("zgb")->__("注册地址"),
				"name" => "address",
				));
			
				$fieldset->addField("registered_capital", "text", array(
				"label" => Mage::helper("zgb")->__("注册资本"),
				"name" => "registered_capital",
				));
			
				$fieldset->addField("registered_no", "text", array(
				"label" => Mage::helper("zgb")->__("注册号"),
				"name" => "registered_no",
				));
			
				$fieldset->addField("registered_date", "text", array(
				"label" => Mage::helper("zgb")->__("注册日期"),
				"name" => "registered_date",
				));
			
				$fieldset->addField("registration_authority", "text", array(
				"label" => Mage::helper("zgb")->__("登记机关"),
				"name" => "registration_authority",
				));
			
				$fieldset->addField("business_type", "text", array(
				"label" => Mage::helper("zgb")->__("企业类型"),
				"name" => "business_type",
				));
			
				$fieldset->addField("business_entity", "text", array(
				"label" => Mage::helper("zgb")->__("法定代表人"),
				"name" => "business_entity",
				));
			
				$fieldset->addField("business_scope", "text", array(
				"label" => Mage::helper("zgb")->__("经营范围"),
				"name" => "business_scope",
				));
			
				$fieldset->addField("business_term", "text", array(
				"label" => Mage::helper("zgb")->__("营业期限"),
				"name" => "business_term",
				));
			
				$fieldset->addField("product_services", "textarea", array(
				"label" => Mage::helper("zgb")->__("主营产品或服务"),
				"name" => "product_services",
				));
					

				if (Mage::getSingleton("adminhtml/session")->getManufacturerData())
				{
					$form->setValues(Mage::getSingleton("adminhtml/session")->getManufacturerData());
					Mage::getSingleton("adminhtml/session")->setManufacturerData(null);
				} 
				elseif(Mage::registry("manufacturer_data")) {
				    $form->setValues(Mage::registry("manufacturer_data")->getData());
				}
				return parent::_prepareForm();
		}
}
